package zom.zbw.common.controller;


import com.zbw.common.entity.Author;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zom.zbw.common.service.FrontAuthorService;

@RestController
@RequestMapping("author")
@RequiredArgsConstructor
@Slf4j
public class FrontController {


    private final FrontAuthorService frontAuthorService;

    @RequestMapping("checkPenName")
    Boolean checkPenName(String penName){

        return frontAuthorService.checkPenName(penName);
    }


    @RequestMapping("register")
    String register(Long userId, Author author)
    {
        return frontAuthorService.register(userId,author);
    }


    @RequestMapping("queryAuthor")
    Author queryAuthor(Long userId){

        return frontAuthorService.queryAuthor(userId);
    }

    @RequestMapping("isAuthor")
    boolean isAuthor(Long userId){

        return frontAuthorService.isAuthor(userId);
    }
}
